this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(e,t,i,n,a,r,l){"use strict";var s,o,d,u,c,p,b,v,h,f,g;function y(e,t){H(e,t);t.add(e)}function m(e,t,i){H(e,t);t.set(e,i)}function H(e,t){if(t.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function P(e,t,i){if(!t.has(e)){throw new TypeError("attempted to get private field on non-instance")}return i}function w(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function F(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?w(Object(i),!0).forEach((function(t){babelHelpers.defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):w(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var T=BX.UI;var C=BX.SidePanel;function B(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};e=Object.assign({},e);e.design=Object.assign({},e.design||{});e.design=F({margin:true,section:true},e.design);e.extensions=(e.extensions||[]).concat(["ui.sidepanel.layout","ui.buttons"]);if(e.toolbar){e.extensions.push("ui.buttons.icons")}if(e.design.section){e.extensions.push("ui.sidepanel-content")}if(e.menu){e.extensions.push("ui.sidepanel.menu")}return e}var G=new WeakMap;var O=new WeakMap;var j=new WeakMap;var S=new WeakMap;var k=new WeakSet;var E=new WeakSet;var X=new WeakSet;var L=function(){babelHelpers.createClass(e,null,[{key:"createContent",value:function t(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};i=B(i);return top.BX.Runtime.loadExtension(i.extensions).then((function(){return new e(i).render()}))}},{key:"createLayout",value:function t(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};i=B(i);return top.BX.Runtime.loadExtension(i.extensions).then((function(){return new e(i)}))}}]);function e(){var t=this;var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);y(this,X);y(this,E);y(this,k);m(this,G,{writable:true,value:void 0});m(this,O,{writable:true,value:void 0});m(this,j,{writable:true,value:void 0});m(this,S,{writable:true,value:void 0});babelHelpers.classPrivateFieldSet(this,j,B(i));var a=babelHelpers.classPrivateFieldGet(this,j).menu;if(a){babelHelpers.classPrivateFieldSet(this,S,new l.Menu(Object.assign(a)));if(n.Type.isUndefined(a.contentAttribute)){a.contentAttribute="data-menu-item-id"}if(a.contentAttribute){babelHelpers.classPrivateFieldGet(this,S).subscribe("click",(function(e){P(t,X,I).call(t,(e.getData()||{}).item)}))}}}babelHelpers.createClass(e,[{key:"getContainer",value:function e(){if(!babelHelpers.classPrivateFieldGet(this,G)){babelHelpers.classPrivateFieldSet(this,G,n.Tag.render(s||(s=babelHelpers.taggedTemplateLiteral(['<div class="ui-sidepanel-layout"></div>']))))}return babelHelpers.classPrivateFieldGet(this,G)}},{key:"getMenu",value:function e(){return babelHelpers.classPrivateFieldGet(this,S)}},{key:"getFooterContainer",value:function e(){if(!babelHelpers.classPrivateFieldGet(this,O)){babelHelpers.classPrivateFieldSet(this,O,n.Tag.render(o||(o=babelHelpers.taggedTemplateLiteral(['<div class="ui-sidepanel-layout-footer"></div>']))))}return babelHelpers.classPrivateFieldGet(this,O)}},{key:"render",value:function e(){var t=this;var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(babelHelpers.classPrivateFieldGet(this,j).content&&!a){i=babelHelpers.classPrivateFieldGet(this,j).content();if(Object.prototype.toString.call(i)==="[object Promise]"||i.toString&&i.toString()==="[object BX.Promise]"){return i.then((function(e){return t.render(e,true)}))}}var l=this.getContainer();l.innerHTML="";if(babelHelpers.classPrivateFieldGet(this,j).title){var s=n.Tag.safe(d||(d=babelHelpers.taggedTemplateLiteral(["",""])),babelHelpers.classPrivateFieldGet(this,j).title);var o=n.Tag.render(u||(u=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="ui-sidepanel-layout-header">\n\t\t\t\t\t<div class="ui-sidepanel-layout-title">',"</div>\n\t\t\t\t</div>\n\t\t\t"])),s);if(n.Type.isFunction(babelHelpers.classPrivateFieldGet(this,j).toolbar)){var g=n.Tag.render(c||(c=babelHelpers.taggedTemplateLiteral(['<div class="ui-sidepanel-layout-toolbar"></div>'])));babelHelpers.classPrivateFieldGet(this,j).toolbar(F({},T)).forEach((function(e){if(e instanceof r.BaseButton){e.renderTo(g)}else if(n.Type.isDomNode(e)){g.appendChild(e)}else{throw n.BaseError("Wrong button type "+e)}}));o.appendChild(g)}l.appendChild(o)}{var y=babelHelpers.classPrivateFieldGet(this,j).design;var m=["ui-sidepanel-layout-content"];var H=[];if(y.margin){if(y.margin===true){m.push("ui-sidepanel-layout-content-margin")}else{H.push("margin: "+y.margin)}}var w=n.Tag.render(p||(p=babelHelpers.taggedTemplateLiteral(['<div class="','" style="','"></div>'])),m.join(" "),H.join("; "));l.appendChild(w);if(babelHelpers.classPrivateFieldGet(this,S)){babelHelpers.classPrivateFieldGet(this,S).renderTo(w)}w.appendChild(n.Tag.render(b||(b=babelHelpers.taggedTemplateLiteral(['<div class="ui-sidepanel-layout-content-inner"></div>']))));w=w.lastElementChild;if(y.section){w.appendChild(n.Tag.render(v||(v=babelHelpers.taggedTemplateLiteral(['<div class="ui-slider-section ui-sidepanel-layout-content-fill-height"></div>']))));w=w.firstElementChild}if(typeof i==="string"){w.innerHTML=i}else if(i instanceof Element){w.appendChild(i)}if(babelHelpers.classPrivateFieldGet(this,S)){P(this,X,I).call(this,babelHelpers.classPrivateFieldGet(this,S).getActiveItem(),w)}}var B=typeof babelHelpers.classPrivateFieldGet(this,j).buttons==="undefined";if(typeof babelHelpers.classPrivateFieldGet(this,j).buttons==="function"||B){var G=new r.CancelButton({onclick:function e(){return C.Instance.close()}});var O=new r.CloseButton({onclick:function e(){return C.Instance.close()}});var k=F(F({},T),{},{cancelButton:G,closeButton:O});if(B){babelHelpers.classPrivateFieldGet(this,j).buttons=function(){return[O]}}var E=babelHelpers.classPrivateFieldGet(this,j).buttons(k);if(E&&E.length>0){l.appendChild(n.Tag.render(h||(h=babelHelpers.taggedTemplateLiteral(['<div class="ui-sidepanel-layout-footer-anchor"></div>']))));var L=["ui-sidepanel-layout-buttons"];if(babelHelpers.classPrivateFieldGet(this,j).design.alignButtonsLeft){L.push("ui-sidepanel-layout-buttons-align-left")}var W=n.Tag.render(f||(f=babelHelpers.taggedTemplateLiteral(['<div class="','"></div>'])),L.join(" "));this.getFooterContainer().appendChild(W);E.forEach((function(e){if(e instanceof r.BaseButton){e.renderTo(W)}else if(n.Type.isDomNode(e)){W.appendChild(e)}else{throw n.BaseError("Wrong button type "+e)}}));l.appendChild(this.getFooterContainer())}}setTimeout((function(){t.afterRender()}));return l}},{key:"afterRender",value:function e(){P(this,E,x).call(this);var t=n.Runtime.throttle(P(this,E,x),300,this);n.Event.bind(window,"resize",t);var i=C.Instance.getTopSlider();if(i){a.EventEmitter.subscribeOnce(i,"SidePanel.Slider:onDestroy",(function(){n.Event.unbind(window,"resize",t)}))}}}]);return e}();function W(){var e=n.Tag.render(g||(g=babelHelpers.taggedTemplateLiteral(['<div style="overflow-y: scroll; width: 50px; height: 50px; opacity: 0; pointer-events: none; position: absolute;"></div>'])));document.body.appendChild(e);var t=e.offsetWidth-e.clientWidth;n.Dom.remove(e);return t}function x(){var e=this.getContainer().parentNode;if(e.scrollWidth>e.offsetWidth){n.Dom.style(this.getFooterContainer(),"bottom",P(this,k,W).call(this)+"px")}else{n.Dom.style(this.getFooterContainer(),"bottom",0)}}function I(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;if(!e){return}var i=e.getId();var n=babelHelpers.classPrivateFieldGet(this,j).menu.contentAttribute;if(!n){return}t=t||babelHelpers.classPrivateFieldGet(this,G);var a=t.querySelectorAll("[".concat(n,"]"));a=Array.prototype.slice.call(a);a.forEach((function(e){e.hidden=e.getAttribute(n)!==i}))}e.Layout=L})(this.BX.UI.SidePanel=this.BX.UI.SidePanel||{},BX,BX,BX,BX.Event,BX.UI,BX.UI.SidePanel);
//# sourceMappingURL=bundle.map.js